/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PanImageGlass.java
 *
 * Created on 11 janv. 2012, 09:06:08
 */
package InterfaceGraphique.commonPannel;

import java.awt.Graphics;
import java.awt.image.BufferedImage;

/**
 *
 * @author arthur.hoareau
 */
public class PanImageGlass extends javax.swing.JPanel {

    private BufferedImage  image;
    private double x;
    private double y;
    
    
    /**
     * Constructeur de la classe
     * @param img
     * @param x
     * @param y 
     */
    public PanImageGlass(BufferedImage img,double x, double y) {
        this.image=img;
        this.x= this.fixPostion(x-80);
        this.y= this.fixPostion(y-190);   
    }

    /**
     * surcharge de la methode paintComponent pour pouvoir afficher l'image
     * @param g 
     */
    @Override
    protected void paintComponent(Graphics g) {
        g.drawImage(image, (int) x, (int) y, 280, 440,null);
        super.paintComponent(g);
    }

    private double fixPostion(double d) {
        if ( d < 0 )
            return 0;
        else 
            return d;
    }
}
